﻿#ifndef SINGLETON_H
#define SINGLETON_H

template<class T>
class CSingleton
{
public:
	static T * instance()
	{
        if(m_instance == nullptr)
			m_instance = new T();

		return m_instance;
	}
protected:
	CSingleton()
	{

	}
	virtual ~CSingleton()
	{

	}

private:
	static T * m_instance;

};

template<class T>
T * CSingleton<T>::m_instance = nullptr;
#endif
